Tutorial 5:
Creating and Editing Environment Tags Using Halo 2
Guerilla
|
|
Strictly speaking, your environment does not need
any .shader files, but without them you
won't have any textures. Also, you can have numerous .shader files to specify different shaders for your environment, but this tutorial
will only demonstrate a simple one, appropriate for a floor in your
sample level.
Note:
Keep in mind that whenever you're working in Halo 2 Guerilla, you're working in
the \main\tags directory, which is a mirror of the directory
structure contained in \main\data.
To create and edit a shader file
1.
Start Halo 2
Guerilla.
2.
On the File
menu, click New.
A dialog box appears, asking what type of file you want to
create.
3.
Click Shader in the list, and
then click OK.
A nearly empty window representing the new file appears.
4.
Before you can specify what the shader looks like, you need to select a
shader template, which defines what basic
type of shader you're creating. There
are many templates to choose from, but typically you just want an
opaque surface with a bump map and possibly a detail or environment
map. The functionality of a given template is loosely explained by
its filename.
To select a template, click Browse to the right of the same
line as the template is printed.
The Select File dialog
box appears.
5.
Browse to the Halo
2 Tools installation folder and then to tags\shaders\shader_templates.
You'll find several folders with different types of templates, but
you just want a floor texture, so open the opaque folder.
You should now be looking at the contents of tags\shaders\shader_templates\opaque.
These opaque files have numerous small differences, but for
your purposes select tex_bump.shader_template.
This is an opaque template that allows you to specify a diffuse map
(color), a bump map (surface relief, bumps, and so on), and a
detail map (a sort of noise that adds fine grain to the surface in
the game).
After selecting tex_bump.shader_template, click Open.
6.
A lot more fields are now available for editing. You will
want to fill in four of these for this tutorial.
First, click Browse next
to base_map.
The Select File dialog
box appears.
7.
Make this a concrete texture by browsing to an
appropriate .bitmap file, which will provide the image format the
Halo 2 game image uses,
so any textures you want to use in a shader need to be in that format. They're created
using Halo 2 Tool.
Use the concrete texture from Zanzibar. Browse to tags\scenarios\bitmaps\multi\zanzibar,
select basic_concrete.bitmap, and
then click Okay.
The base_map line now has basic_concrete listed.
8.
Because the base map is just the colors of the surface,
you'll want to give it some relief. This is done using a bump map,
specified in the line labeled, appropriately enough, bump_map.
Click Browse next to
bump_map, select
basic_concrete_bump.bitmap
in the same folder, and then click Open.
Now you have a texture with both color and the appropriate bumps
and ridges.
9.
When you zoom into your map, you’ll want it to show
appropriate graininess. For this you’ll use a detail map.
Click Browse next to
detail_map, browse to
tags\scenarios\bitmaps\detail_maps\concrete, click concrete_pitted.bitmap,
and then click Open.
The concrete_pitted file is now listed
as your detail_map.
10.
Finally, you need to scale down the
detail map; otherwise, it will be the same size as the other maps
and its detail will be lost. You'll notice several scale fields
listed for all the maps, although generally you'll only want detail
to be scaled differently than the others. (There are many tricks
you can do by editing the other fields once you become accustomed
to working with shader files.) In this
case, you want the detail map to be scaled much smaller than the
other maps.
Click f() to the far right of
detail_map_scale_x.
A dialog box with a number of fields in it appears. The one you
want to edit is just below Input, and by default it shows
16. This is a little too
small (the number dictates how many times this texture tiles for
each time the base texture does).
Type 6 in the Input box, and then press the
ENTER key.
You will now see the value 6.00 listed next to detail_map_scale_x.
Repeat this step for detail_map_scale_y.
Your shader file is now complete.
11.
To save it, click Save As on the File menu.
The Save File dialog box
appears.
12.
Typically you'll want to save new
shaders in a folder named after the
level they'll be used in. Assuming your level is called
MyLevel, browse to tags\scenarios\shaders\multi\MyLevel, and then click Open.
You will now be viewing the contents of your
tags\scenarios\shaders\multi\MyLevel
folder.
13.
Name your shader file concrete.shader, and then
click Save.
To use your new shader file
Your shader has been
saved, but you can't use it in a level quite yet. Before that
happens, you need to create a new shader collection for your MyLevel folder. A shader_collection file is a text file listing a
collection name (used in your material name in your .max file) and
the path that the collection refers to. Generally, you'll want to
name the collection after your level, to avoid conflicts with any
other levels' collections.
1.
Start Notepad.
2.
You need to add two fields: The first is your
collection's name, and the second is the path to the shaders in your collection. Type
mylev scenarios\shaders\multi\mylevel
This means that when you type
mylev into a material
name, 3ds Max will use the shaders in
scenarios\shaders\multi\mylevel.
3.
On the File
menu, click Save As.
The Save File dialog box
appears.
4.
Browse to your working folder and then to tags\scenarios\shaders, click All Files in the Save as Type box, type
mylevel.shader_collection
in the Filename box, and
then click Save.
Remember that you can always open a shader_collection file in Notepad and edit it
later. You only need to create a new one when you create a new
folder for your shaders.
5.
Now that you have a shader
collection, you can use your shader
file in your level. Begin by opening your level in 3ds Max.
6.
All that's necessary is to change the material name of
your material to one using the new shader. If you've opened mylevel, the box map in the earlier tutorial, bring
up the material window by pressing M and then selecting your level's
Multi/Sub-Object material.
7.
The bottom half of your material window should list all
your submaterials. Find the one you're
using for your floor, and then click its name to view its
properties.
8.
Change the name of your floor material to mylev
concrete.
Note that this is the name of your shader collection (from inside the shader_collection file) followed by the filename of
the shader you created. Together, these
tell the exporter where to look and for what shader filename.
9.
Export your level as you did in the level creation
tutorial, and your new shader should be
visible.
Note:
Remember that you only need one shader
collection specified per folder and that you should try to name
that collection after your level. Try to pick something unique;
otherwise, someone else's collection (or level) might use the same
name and things might not work right.